import urllib.parse
import urllib.request

get_url = 'https://i1.hdslb.com/bfs/archive/51033fe3f9e0ff5bb29d94736662b38e49590c9b.jpg@203w_127h_1e_1c.webp'

handers = {
    'Accept': 'application/json, text/plain, */*',
    #Accept-Encoding: gzip, deflate, br
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    'Cookie': 'l=v; fts=1519230065; sid=ldhypulk; buvid3=322DE987-0D1B-453E-9733-39F3C645FB3412196infoc; pgv_pvi=1045458944; rpdid=kwilwlqxwpdosolikwipw; LIVE_BUVID=3d707ad9f69f3ecb17c91b45b274b95e; LIVE_BUVID__ckMd5=e3980a31fd86963b; stardustvideo=1; CURRENT_QUALITY=116; UM_distinctid=166b3d43351573-013f606cd594da-8383268-1fa400-166b3d43352446; CURRENT_FNVAL=16; _ga=GA1.2.686673692.1543753494; finger=17c9e5f5; im_notify_type_8142188=0; bp_t_offset_8142188=201831761758796803; DedeUserID=8142188; DedeUserID__ckMd5=356addbc94117fcd; SESSDATA=5750ffbd%2C1548834981%2C833d00c1; bili_jct=a7fb85f4aee065c95c836081632ed684; _dfcaptcha=08e82826f35fa9e70cdca40d3eb3721f',
    'Host': 'api.vc.bilibili.com',
    'Origin': 'https://t.bilibili.com',
    'Pragma': 'no-cache',
    'Referer': 'https://t.bilibili.com/?tab=8',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36',
}

request = urllib.request.Request(url = get_url)

response = urllib.request.urlopen(request)
# print(response.read().decode())
with open('1.jpg',"wb") as f:
    f.write(response.read())

